package com.doit.demo01;

import java.util.Calendar;

public class test_Calendar {
    public static void main(String[] args) {
        Calendar c =Calendar.getInstance();
        System.out.println(c);

        int year = c.get(Calendar.YEAR);
        System.out.println(year);
        int month = c.get(Calendar.MONTH);
        System.out.println(month);
        int day = c.get(Calendar.DATE);
        System.out.println(day);
        int hour = c.get(Calendar.HOUR);
        System.out.println(hour);

        System.out.println("++++++++++++++++++++++++++++");
        Calendar cc = Calendar.getInstance();
        cc.add(Calendar.YEAR,-21);
        cc.add(Calendar.MONTH,+3);
        System.out.println(cc.getTime());

        cc.set(Calendar.YEAR,2001);
        cc.set(Calendar.MONTH,9);
        System.out.println(cc.getTime());

        cc.set(2020,9,1,10,15,15);
        System.out.println(cc.getTime());
    }
}
